__author__ = "Ypf"
_date_ = "2019/7/29-11:38"
#产品经理
PRODUCT_MGR_LIST = ['熊国明','徐少平','王祝良']
PRODUCT_USER_NAME_MAP = {
    '8a8080821204f5ca011202a14b2e0699':('熊国明',1),    #1 产品经理
    '13980475612760132791835909582535':('徐少平',1),
    '14434032027690148468216105412843':('王祝良',1),
    '14443515075901002890370394544594':('张文东',2),   #2 产品总监
    '15209283307944653210454274050050':('谢金堂',2),
}


#产品总监
PRODUCT_DICT_LIST = ['张文东', '谢金堂']
crm_cal_fields = {
    # 客户经理报表 --- 销售积分，客户绩效

    'account_rp': {
        'xsjf_score': "select    idowner ,sum(xsjf)  from 	activity  where dclose BETWEEN '%s' and '%s' GROUP BY idowner  ",
        'id_sname': "select DISTINCT ID,	sName  from  org_employee",
        'kehu_jixiao': "select xiangmuchanp2.idowner, sum(xiangmuchanp2.jxjf) from xiangmuchanp2, salesoppt2 where  xiangmuchanp2.gzzt = salesoppt2.id and salesoppt2.sname like '%s' GROUP BY  xiangmuchanp2.idowner"
        ,
        "dbkhjlquanbu_insert_sql": "insert into khjlrcgz(id,sname, xsjf, xsblz, khjx, khblz, exjfhj, jfhjpjf,jxgzdjpd,byjxgzxs,begintim,endtime) "
                                   "values('%s','%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s','%s','%s')",
        "dbkhjldandu_insert_sql": "insert into khjlrcgz2(id,sname, xsjf, xsblz, 	khjx, khblz, exjfhj, jfhjpjf,jxgzdjpd,byjxgzxs,	begintim,endtime) "
                                  "values('%s','%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s','%s','%s')", },

    #销售经理数据报表
    'sales_rp':{"tjjx_score":"SELECT sum(xsgljx),gzzdr from activity where dclose  BETWEEN  '%s' and  '%s'  and gzzdr!='' GROUP BY  gzzdr ",
                'id_sname':"select DISTINCT	ID,	sName  from  org_employee",
                "bgjf_score":"SELECT sum(bgjf),idowner from activity5 where 	dend  BETWEEN  '%s'  AND  '%s'  GROUP BY  	idowner",
                "xsjl_insert_sql": "insert into xsjlrcgz (id,pqjl,tjjf,	tjjfblz,tjjx, tjjxblz, bgjf, bgjfblz, xszjtjdf,zjljldf,dyjfhj,jfgpjf,	jxgzpddj,byjxgzxs,	kssj,jssj) "
                                 "values('%s','%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s', '%s', '%s', '%s', '%s', '%s', '%s')"
                },

    #产品经理数据报表
    #khgz_score:客户跟踪计划报告产品指导统计积分，xmgz_score：项目跟踪管理的统计积分，glgz_score:管理跟踪报告积分,
    'product_rp':{
                "khgz_score":("select    sum(cpjf),cycp  from  activity where dclose BETWEEN '%s' and '%s' group by  cycp", 40),
                #xmgz_score   从项目跟踪计划明细表查询，计划主题：2019-5， 产品经理
                "xmgz_score":("select sum(xiangmuchanp2.cpkf) as score,  xiangmuchanp2.cpjl from  salesoppt2, xiangmuchanp2 where salesoppt2.id = xiangmuchanp2.gzzt  and salesoppt2.sname like '%s'  group by   xiangmuchanp2.cpjl", 30),
                #glgz_score：既要从产品跟踪计划报告中获取，又要从管理跟踪计划报告中获取,取并集
                "glgz_score":("SELECT sum(bgjf) as  score,idowner from activity5 where  dend  BETWEEN  '%s'  AND  '%s'  GROUP BY  	idowner",
                              "SELECT sum(bgjx) as score, idowner   from activity52   where  dend   BETWEEN  '%s'  AND  '%s'  GROUP BY  	idowner", 30),
                "db_insert_sql":"insert into cpjlrckh(id,sname, endtime, cpscore, cprate, xmscore, xmrate, glgzsore,glgzrate,mtscore,avscore,jxgzpd,mtxishu,begtime,khmonth) "
                                  "values('%s','%s', '%s', '%s', '%s', '%s', '%s', '%s','%s','%s', '%s', '%s', '%s', '%s', '%s')"},



}

jingli_list = ['叶元', '胡小军', '李振刚', '曹明会','高建华']
jlcc_dic={'叶元':4,'胡小军':5,'李振刚':0, '曹明会':3,'高建华':0,}
workday=21
kehujili_general_list=['卜青伟','陈旭','崔涛','瞿浩','栾成举','郭博文','孙柏荣','汪世来']

xsjl_list=['叶元', '胡小军', '李振刚', '曹明会']


# 销售经理绩效配置
khul_xishu={'叶元':1,'卜青伟':1,'胡小军':1,'李振刚':1,'高建华':1,'邓天鹤':1,'曹明会':1,'侯磊':0.7,'陈旭':0.7,'瞿浩':0.7,'汪世来':0.6,'崔涛':0.6,'孙柏荣':0.6,'吴浩':0.6,'郭博文':0.6,'栾成举':0.6}
xiaoshoujingli_dic={'曹明会':['卜青伟*','汪世来*','曹明会'],'叶元':['瞿浩*','叶元'],'李振刚':['侯磊*','孙柏荣*','李振刚'],'胡小军':['陈旭*','崔涛*','郭博文*','胡小军']}
xsjl_jl_dic={'曹明会':[0,0],'叶元':[0,0],'李振刚':[0,0],'胡小军':[0,0]}

